<?
include "include/config.php";
	
$tip=array ('1'=>'Garsoniera','2'=>'Apartament 2 camere','3'=>'Apartament 3 camere','4'=>'Apartament 4 camere','5'=>'Teren','6'=>'Spatiu Comercial','7'=>'Casa/Vila');
$oferta=array ('1'=>'Vanzare','2'=>'Inchiriere');
$valuta=array ('0'=>'Discutabil','1'=>'RON','2'=>'EURO','3'=>'USD'); 
$smarty->assign('valuta',$valuta); 
$smarty->assign('tip',$tip);
$smarty->assign('oferta',$oferta);

$user_mod_query=mysql_query("select id,name from users where level=10 ");
$agents["0"]="Alegeti agent";	
while ($users=mysql_fetch_array($user_mod_query)) {
    $agents[$users["id"]] =$users["name"];
}
$smarty->assign('agent',$agents);


$_query = mysql_query("select oferta.*,locatii.name,parent.name as parent from oferta left join locatii on oferta.id_loc=locatii.id left join locatii as parent on parent.id=locatii.id_parent where oferta.id='".$_GET['id']."' " );
   while ($cereri_array=mysql_fetch_array($_query)) {
	 $cereri_array["detalii"]=nl2br($cereri_array["detalii"]);
	 
	 list($idp,$numep)=mysql_fetch_array(mysql_query("select L0.id,L0.name from locatii L0 left join locatii L1 on L1.id_parent=L0.id where L1.id='".$cereri_array['parentid']."'   "));                   
      
		  if ($idp!='') $cereri_array['parent']=$numep;
		  $_data=$cereri_array;
  }
$smarty->assign('data',$_data);

$sql_main=mysql_query("select src from `imagini`   WHERE id_oferta='".$_GET['id']."' ");

while(list($img_rest)=mysql_fetch_array($sql_main)) {
	$images_src_mari[]=srvurl."imagini/mari/".$img_rest;
	$images_src_thumb[]=srvurl."imagini/thumbs/".$img_rest;
}


$smarty->assign("pics_mari",$images_src_mari);
$smarty->assign("pics_thumb",$images_src_thumb);

$smarty->assign("content", $smarty->fetch(tmpd.'descriere'.tmpl_ext));
include "include/make_page.php";
?>
